<%--
  Created by IntelliJ IDEA.
  User: 86150
  Date: 2021/7/13
  Time: 16:05
  To change this template use File | Settings | File Templates.
--%>
<<%@ page language="java" contentType="text/html; charset=UTF-8"
          pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>编号生成</title>
    <!-- CSS -->
    <link rel="stylesheet" href="${mybasePath}assets/bootstrap/css/bootstrap.min.css">
    <jsp:include page="../include/headtag.jsp" />
    <!-- <link rel="stylesheet"
        href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500"> -->
    <link rel="stylesheet"
          href="assets/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="assets/css/form-elements.css">
    <link rel="stylesheet" href="assets/css/style.css">


    <script type="text/javascript">
        var dm;
        var dv;
        var dmlength;

    function enumDiv(a,b,c){
        dm=a.split(","); //字符分割
        dv=b.split(","); //字符分割
        dmlength=dm.length;
        var html="";
        for (var i = 0; i < dmlength; i++) {
            html=html+'<option value="'+dv[i]+'">'+dm[i]+'</option>';
        }
        $(eval(c)).append(html);
    }
        function isEmpty() {
            var inputlist = document.getElementsByTagName("input");
            for (var i = 0; i < inputlist.length; i++) {
                if (inputlist[i].type == "text" && inputlist[i].value == "") {
                    layer.alert("信息未完善，请输入！");
                    return false;
                }
            }
            return true;
        }
    </script>
</head>
<body>
<jsp:include page="../include/head.jsp" />
<jsp:include page="../include/menu.jsp" />
<div id="page-wrapper" style="margin-top: 50px;">
    <div id="page-inner">
        <div class="row">
            <div class="col-md-12">
                <div class="text-left">
                    <a href="/index">首页</a>&nbsp;&gt;&nbsp;<a href="/codeGenerateIndex" class="acts CurrChnlCls">确认规则</a> <!--&gt; <a href="/codeGenerateInfo" class="acts CurrChnlCls">码段信息填写</a>-->
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <h3 class="text-left">编号生成&nbsp;&nbsp;&nbsp;&nbsp;
                    <img src ="${pageContext.request.contextPath}/assets/img/functionImg/codegene1.png"width="900px" height="90px" /></h3>
            </div>
        </div>
        <hr />
        <br />
        <div class="container-fluid">
            <form  action="/codeGenerate" class="col-sm-12 select-info table-bordered" method="post" onsubmit="isEmpty()">
                <table class="table-bordered">
                    <br />
                    <tr>
  <!------------------------------选择码节点信息--------------------------->
                <c:set var="j" value="0" />
                <c:set var="k" value="0" />
                <c:forEach var="i" begin="1" end="${count}" varStatus="s">
                    <c:choose>
                        <c:when test="${enumsum[j].codeCodeId==i}" >
                        <input type="hidden" id="codeRuleId1" value="${enumsum[0].codeRuleId}" name="codeRuleIdd">
                                <div class="col-md-2">
                                    <label for="categoryOptions${enumsum[j].codeCodeId}">${enumsum[j].details}</label>

                                </div>
                                <div class="col-md-2">
                                    <select id="categoryOptions${enumsum[j].codeCodeId}" class="form-control" role="select" name="categoryOptions">
                                        <input type="hidden" id="categoryOptionsLength${enumsum[j].codeCodeId}" value="${enumsum[j].codeLength}" name="categoryOptionsLength">
                                        <script type="text/javascript">
                                            enumDiv("${enumsum[j].detailsNames}","${enumsum[j].basicEnumerations}","categoryOptions${enumsum[j].codeCodeId}");
                                        </script>
                                    </select>
                                </div>
                            <c:set var="j" value="${j+1}" />
                        </c:when>
                        <c:otherwise>
                        <input type="hidden" id="codeRuleId2" value="${nonenumsum[0].codeRuleId}" name="codeRuleIdd">
                                <div class="col-md-2">
                                    <label for="categoryOptions${nonenumsum[k].codeCodeId}">${nonenumsum[k].details}</label>
                                    <input type="hidden" id="categoryOptionsLength${nonenumsum[k].upperLimit}" value="${nonenumsum[k].upperLimit}" name="categoryOptionsLength">
                                </div>
                                <div class="col-md-2">
                                    <input  type="number" value="${nonenumsum[k].lowerLimit}" id="categoryOptions${nonenumsum[k].codeCodeId}"  class="form-control" name="categoryOptions" onchange="limit('${nonenumsum[k].upperLimit}','${nonenumsum[k].lowerLimit}',this)" oninput="limitUpperLower('${nonenumsum[k].upperLimit}','${nonenumsum[k].lowerLimit}',this)">
                                        <script type="text/javascript">
                                            function limit(max,min,op) {
                                                var text1 =new Number(op.value.replace(/\b(0+)/gi,""));
                                                if(text1>max){
                                                    text1 = max;
                                                }
                                                if(text1<min){
                                                    text1=min;
                                                }
                                                op.value=text1.toString();
                                            }
                                        </script>
                                    </input>
                                </div>
                            <c:set var="k" value="${k+1}" />
                        </c:otherwise>
                    </c:choose>
                        <c:choose>
                            <c:when test="${i==3}">
                             <tr><br/><br/></tr>
                            </c:when>
                        </c:choose>
                </c:forEach>
                    </tr>
                    <br />

                    <!------------------------------码节点确认提交--------------------------->
                    <br />
                    <div class="col-md-3"></div>
                    <div class="col-md-6">
                        <button  type="submit"  name="confirmm"  >确认生成编号</button>
                    </div>
                    <hr />
                    <br />
                </table>
            </form>

        </div>
    </div>
</div>
</body>
<!-- Javascript -->
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/bootstrap/js/jquery.min.js"></script>
<script src="assets/js/jquery.backstretch.min.js"></script>
<!--------------------------------跳转页面并信息检查------------------------------------->
<script type="text/javascript">
    function redir_to_endd() {
        window.location.href = "/tocodeGenerateResult";
    }
</script>
</html>
